package com.aw.guiguzi.module.manager._user.presenters

import com.aw.baselib.base.AwCommonPresenter
import com.aw.baselib.net.callback.AwApiCallback
import com.aw.guiguzi.bean.UserInfoBean
import com.aw.guiguzi.module.manager._user.views.UserEditView
import com.aw.guiguzi.net.observers.NetObCommon

/**
 * @author : hzw
 */
class UserEditPresent(private val mView: UserEditView.View) : AwCommonPresenter(),
    UserEditView.Presenter {
    override fun updateUserInfo(bean: UserInfoBean?) {
        addIOSubscription(
            NetObCommon.updateUserInfo(bean),
            object : AwApiCallback<Boolean>(mView, true, true) {
                override fun onSuccess(result: Boolean) {
                    mView.updateUserInfoSuccess()
                }

                override fun onFail(code: Int, msg: String) {
                    super.onFail(code, msg)
                    mView.showMsg(msg)
                }
            })
    }
}